home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / windownt / tusrc.zip / LIB / BCOPY.C < prev    next >
C/C++ Source or Header  |  1993-10-03  |  565b  |  20 lines

  1. /* bcopy.c -- copy memory.
  2.    Copy LENGTH bytes from SOURCE to DEST.  Does not null-terminate.
  3.    In the public domain.
  4.    By David MacKenzie <djm@gnu.ai.mit.edu>.  */
  5.  
  6. void
  7. bcopy (source, dest, length)
  8.      char *source, *dest;
  9.      unsigned length;
  10. {
  11.   if (source < dest)
  12.     /* Moving from low mem to hi mem; start at end.  */
  13.     for (source += length, dest += length; length; --length)
  14.       *--dest = *--source;
  15.   else if (source != dest)
  16.     /* Moving from hi mem to low mem; start at beginning.  */
  17.     for (; length; --length)
  18.       *dest++ = *source++;
  19. }
  20.